home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / iconed1a / iconwrks.gbl < prev    next >
Text File  |  1995-06-21  |  18KB  |  457 lines

  1. Attribute VB_Name = "Module1"
  2. '-----------------------------------------------------------------------
  3. '               Copyright (C) 1991 Microsoft Corporation
  4. '
  5. ' You have a royalty-free right to use, modify, reproduce and distribute
  6. ' the Sample Application Files (and/or any modified version) in any way
  7. ' you find useful, provided that you agree that Microsoft has no warranty,
  8. ' obligations or liability for any Sample Application Files.
  9. '
  10. ' -----------------------------------------------------------------------
  11. #If Win32 Then
  12.     DefLng H
  13. #Else
  14.     DefInt H
  15. #End If
  16. '
  17. ' Type use by the API routine InvertRect()
  18. '
  19. #If Win32 Then
  20. Type RECT
  21.     Left As Long
  22.     Top As Long
  23.     Right As Long
  24.     bottom As Long
  25. End Type
  26. Type POINTAPI
  27.     X As Long
  28.     Y As Long
  29. End Type
  30. Type ICONINFO
  31.     fIcon As Long
  32.     xHotspot As Long
  33.     yHotspot As Long
  34.     hBMMask As Long
  35.     hBMColor As Long
  36. End Type
  37. Type GUID
  38.     Data1 As Long
  39.     Data2 As Integer
  40.     Data3 As Integer
  41.     Data4(7) As Byte
  42. End Type
  43. Type PICTDESC
  44.     cbSizeofstruct As Long
  45.     picType As Long
  46.     Long1 As Long
  47.     Long2 As Long
  48.     Long3 As Long
  49. End Type
  50. Global Const PICTYPE_BITMAP = 1
  51. Global Const PICTYPE_ICON = 3
  52. Type LOGBRUSH
  53.     lbStyle As Long
  54.     lbColor As Long
  55.     lbHatch As Long
  56. End Type
  57.  
  58. Declare Function CreateIconIndirect Lib "User32" (icoinfo As ICONINFO) As Long
  59. Declare Function CreateBrushIndirect Lib "gdi32" (lpLogBrush As LOGBRUSH) As Long
  60. Declare Function ExtFloodFill Lib "gdi32" (ByVal hDC As Long, ByVal X As Long, ByVal Y As Long, ByVal crColor As Long, ByVal fuFillType As Long) As Long
  61. Declare Function DestroyIcon Lib "User32" (ByVal hIcon As Long) As Long
  62. Declare Function OleCreatePictureIndirect Lib "olepro32.dll" (lpPictDesc As PICTDESC, riid As GUID, ByVal fOwn As Long, IPic As IPicture) As Long
  63. Declare Sub CopyMemory Lib "Kernel32" Alias "RtlMoveMemory" (pDest As Any, pSource As Any, ByVal ByteLen As Long)
  64. Declare Function GSM Lib "User32" Alias "GetSystemMetrics" (ByVal nIndex As Long) As Long
  65. Declare Function GetDeviceCaps Lib "gdi32" (ByVal hDC As Long, ByVal nIndex As Long) As Long
  66. Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hDC As Long) As Long
  67. Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
  68. Declare Function SelectObject Lib "gdi32" (ByVal hDC As Long, ByVal hObject As Long) As Long
  69. Declare Function DeleteDC Lib "gdi32" (ByVal hDC As Long) As Long
  70. Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
  71. Declare Function GetStockObject Lib "gdi32" (ByVal nIndex As Long) As Long
  72. Declare Function Polygon Lib "gdi32" (ByVal hDC As Long, lpPoints As POINTAPI, ByVal nCount As Long) As Long
  73. Declare Function CreateCompatibleBitmap Lib "gdi32" (ByVal hDC As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
  74. Declare Function GetBitmapBits Lib "gdi32" (ByVal hBitmap As Long, ByVal dwCount As Long, ByVal lpBits As Any) As Long
  75. Declare Function GlobalLock Lib "Kernel32" (ByVal hMem As Long) As Long
  76. Declare Function GlobalUnlock Lib "Kernel32" (ByVal hMem As Long) As Long
  77. Declare Function GetIconInfo Lib "User32" (ByVal hIcon As Long, icoinfo As ICONINFO) As Long
  78. Declare Function GetNearestColor Lib "gdi32" (ByVal hDC, ByVal RGBColor As Long) As Long
  79. Declare Function GetPrivateProfileInt Lib "Kernel32" Alias "GetPrivateProfileIntA" (ByVal Appname As String, ByVal KeyName As String, ByVal DEFAULT As Long, ByVal FileName As String) As Long
  80. Declare Function GetPrivateProfileString Lib "Kernel32" Alias "GetPrivateProfileStringA" (ByVal Appname As String, ByVal KeyName As String, ByVal DEFAULT As String, ByVal ReturnedString As String, ByVal MaxSize As Long, ByVal FileName As String) As Long
  81. Declare Function WritePrivateProfileString Lib "Kernel32" Alias "WritePrivateProfileStringW" (ByVal Appname As String, ByVal KeyName As String, ByVal NewString As String, ByVal FileName As String) As Long
  82. Declare Function StretchBlt Lib "gdi32" (ByVal hDCDest, ByVal X As Long, ByVal Y As Long, ByVal Width As Long, ByVal Height As Long, ByVal hDCSrc, ByVal srcX As Long, ByVal srcY As Long, ByVal srcWidth As Long, ByVal srcHeight As Long, ByVal Rop As Long) As Long
  83. Declare Function WinHelp Lib "User32" Alias "WinHelpA" (ByVal hWnd, ByVal HelpFile As String, ByVal wCommand As Long, ByVal dwData As Long) As Long
  84. Declare Function InvertRect Lib "User32" (ByVal hDC, lpRect As RECT) As Long
  85.  
  86. Declare Function GetMenu Lib "User32" (ByVal hWnd) As Long
  87. Declare Function GetSubMenu Lib "User32" (ByVal hWnd, ByVal Position As Long) As Long
  88. Declare Function GetSystemMenu Lib "User32" (ByVal hWnd, ByVal bRevert As Long) As Long
  89. Declare Function RemoveMenu Lib "User32" (ByVal hMenu, ByVal nPosition As Long, ByVal wFlags As Long) As Long
  90. Declare Function TrackPopupMenu Lib "User32" (ByVal hMenu, ByVal r1 As Long, ByVal X As Long, ByVal Y As Long, ByVal r2 As Long, ByVal hWnd As Long, ByVal r3 As Long) As Long
  91.  
  92. Global Const BLACK_BRUSH = 4
  93. Global Const NOTSRCERASE = &H1100A6     ' (DWORD) dest = (NOT src) AND (NOT dest)
  94. Global Const WHITENESS = &HFF0062       ' (DWORD) dest = WHITE
  95. Global Const FLOODFILLSURFACE = 1
  96. Global Const SRCAND = &H8800C6  ' (DWORD) dest = source AND dest
  97. Global Const SRCINVERT = &H660046       ' (DWORD) dest = source XOR dest
  98. Global Const SRCCOPY = &HCC0020 ' (DWORD) dest = source
  99. Global Const BLACKNESS = &H4262       ' (DWORD) dest = BLACK
  100. Global Const BITSPIXEL = 12 '  Number of bits per pixel
  101. Global Const PLANES = 14    '  Number of planes
  102. Global Const SM_CXICON = 11
  103. Global Const SM_CYICON = 12
  104. Global Const BS_SOLID = 0
  105. Global Const MF_BYPOSITION = &H400
  106. Global Const HELP_CONTEXT = &H1
  107. Global Const HELP_QUIT = &H2
  108. Global Const HELP_HELPONHELP = &H4
  109.  
  110. Global IID_IDispatch As GUID
  111. #Else
  112. Type RECT
  113.     Left As Integer
  114.     Top As Integer
  115.     Right As Integer
  116.     bottom As Integer
  117. End Type
  118. '
  119. ' Window API Function Declarations
  120. '
  121. Declare Function BitBlt Lib "Gdi" (ByVal hDCDest, ByVal X As Integer, ByVal Y As Integer, ByVal Width As Integer, ByVal Height As Integer, ByVal hDCSrc As Integer, ByVal srcX As Integer, ByVal srcY As Integer, ByVal Rop As Long) As Integer
  122. Declare Function CreateCompatibleBitmap Lib "Gdi" (ByVal hDC, ByVal Width As Integer, ByVal Height As Integer) As Integer
  123. Declare Function CreateCompatibleDC Lib "Gdi" (ByVal hDC) As Integer
  124. Declare Function DeleteDC Lib "Gdi" (ByVal hDC) As Integer
  125. Declare Function DeleteObject Lib "Gdi" (ByVal hObject) As Integer
  126. Declare Function ExtFloodFill Lib "Gdi" (ByVal hDC, ByVal X As Integer, ByVal Y As Integer, ByVal crColor As Long, ByVal wFillType As Integer) As Integer
  127. Declare Function GetBitmapBits Lib "Gdi" (ByVal hBitmap, ByVal dwCount As Long, ByVal lpBits As Long) As Long
  128. Declare Function GetDeviceCaps Lib "Gdi" (ByVal hDC, ByVal nIndex As Integer) As Integer
  129. Declare Function GetMenu Lib "User" (ByVal hWnd) As Integer
  130. Declare Function GetNearestColor Lib "Gdi" (ByVal hDC, ByVal RGBColor As Long) As Long
  131. Declare Function GetPrivateProfileInt Lib "Kernel" (ByVal Appname As String, ByVal KeyName As String, ByVal DEFAULT As Integer, ByVal FileName As String) As Integer
  132. Declare Function GetPrivateProfileString Lib "Kernel" (ByVal Appname As String, ByVal KeyName As String, ByVal DEFAULT As String, ByVal ReturnedString As String, ByVal MaxSize As Integer, ByVal FileName As String) As Integer
  133. Declare Function GetSubMenu Lib "User" (ByVal hWnd, ByVal Position As Integer) As Integer
  134. Declare Function GetSystemMenu Lib "User" (ByVal hWnd, ByVal bRevert As Integer) As Integer
  135. Declare Function GlobalLock Lib "Kernel" (ByVal mMem As Integer) As Long
  136. Declare Function GlobalUnlock Lib "Kernel" (ByVal mMem As Integer) As Integer
  137. Declare Function InvertRect Lib "User" (ByVal hDC, lpRect As RECT) As Integer
  138. Declare Function RemoveMenu Lib "User" (ByVal hMenu, ByVal nPosition As Integer, ByVal wFlags As Integer) As Integer
  139. Declare Function SelectObject Lib "Gdi" (ByVal hDC, ByVal hObject) As I